#include <stdio.h>

int main(void)
{
    int month, day;
    printf("输入日期：\n");
    scanf("%d%d", &month, &day);

    if (month < 1 || day < 1 || month > 12 || day > 31 ) {
        printf("数据范围错误！\n");
        return 0;
    }

    int days[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; // days[i] 表示第 i + 1 月的天数
    int sum[13] = {0}; // sum[i] 表示前 i 月的总天数


    for (int i = 1; i <= 12; i++)
        sum[i] = sum[i - 1] + days[i - 1];

    if (days[month - 1] < day) {
        printf("天数范围错误！\n");
        return 0;
    }

    printf("%d月%d日是2024年的第%d天\n", month, day, sum[month - 1] + day);
    return 0;
}
